Log path strings directly instead of accumulating
authorFelix <felix-git@0xf.eu>
Sat, 4 Jan 2025 15:06:03 +0000 (16:06 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 23 Jan 2025 19:45:09 +0000 (20:45 +0100)
Signed-off-by: Felix <felix-git@0xf.eu>
src/libsync/syncengine.cpp

index 368d0f8c899bdc6ae928b0523513f8b2a9e77352..30fa24115bb0f3795b4ab90144a3ba94acd9e3b0 100644 (file)
@@ -1216,12 +1216,14 @@ void SyncEngine::setLocalDiscoveryOptions(LocalDiscoveryStyle style, std::set<QS
     _localDiscoveryStyle = style;
     _localDiscoveryPaths = std::move(paths);
 
-    const auto allPaths = std::accumulate(_localDiscoveryPaths.begin(), _localDiscoveryPaths.end(), QString{}, [] (auto first, auto second) -> QString {
-                              first += ", " + second;
-                              return first;
-    });
-
-    qCInfo(lcEngine()) << "paths to discover locally" << allPaths;
+    if (lcEngine().isInfoEnabled()) {
+        // only execute if logging is enabled
+        auto debug = qInfo(lcEngine);
+        debug << "paths to discover locally";
+        for (auto path : _localDiscoveryPaths) {
+            debug << path;
+        }
+    }
 
     // Normalize to make sure that no path is a contained in another.
     // Note: for simplicity, this code consider anything less than '/' as a path separator, so for